import random
import pyperclip
from pymouse import *
from pykeyboard import *
import time

m = PyMouse()
k = PyKeyboard()

input = [182, 617]
input1 = [182, 390]
ok = [150, 470]
run = [210, 705]
ks = ['20224WJYZzqM','2022g8h7fE4Q','20222YCQdwBH','20227Z2DtYXb','2022j8PGmU4C','2022tSjUR5Cz','2022AamxR8Tu','2022XpdU6eqj']
id = 0


def copy_code():
    global id
    s = ks[id]
    id += 1
    print(s)
    pyperclip.copy(s)
    keyboard = PyKeyboard()
    keyboard.press_key(keyboard.control_key)  # 按下Ctrl键
    keyboard.tap_key('V')  # 点击V键
    keyboard.release_key(keyboard.control_key)  # 松开Ctrl键


def one():
    m.click(input[0], input[1], 1, 1)
    time.sleep(0.03)
    m.click(input1[0], input1[1], 1, 1)
    # for_code()
    copy_code()
    time.sleep(0.03)
    m.click(ok[0], ok[1], 1, 1)
    time.sleep(0.03)
    m.click(run[0], run[1], 1, 1)
    time.sleep(0.03)
    m.click(run[0], run[1], 1, 1)
    time.sleep(0.01)


k.press_keys([k.windows_l_key, '1'])
k.release_key(k.windows_l_key)
k.release_key('1')
time.sleep(0.003)
while id < len(ks):
    one()
    time.sleep(5)
